<?php

namespace App\VO\UserAddresses;

use App\VO\Interfaces\IVODetail;

class VODetail implements IVODetail
{
    public $addresses = [];

    public function __construct($data)
    {
        $this->addresses = $this->assignAddressList($data['addresses'] ?? null);
    }

    private function assignAddressList($data): array
    {
        $list = [];
        foreach ($data as $addressModel) {
            $list[] = new VOListItem($addressModel);
        }
        return $list;
    }
}
